feat(orm): add support for raw (r#) model and field names#485
feat(orm): add support for raw (r#) model and field names#485
r#) model and field names#485Conversation
4fc04cc to
3af077b
Compare
|
| Branch | raw-field-names |
| Testbed | github-ubuntu-latest |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result microseconds (µs) (Result Δ%) | Upper Boundary microseconds (µs) (Limit %) |
|---|---|---|---|
| empty_router/empty_router | 📈 view plot 🚷 view threshold | 6,494.90 µs(+9.91%)Baseline: 5,909.54 µs | 6,995.49 µs (92.84%) |
| json_api/json_api | 📈 view plot 🚷 view threshold | 1,074.90 µs(+5.09%)Baseline: 1,022.84 µs | 1,166.50 µs (92.15%) |
| nested_routers/nested_routers | 📈 view plot 🚷 view threshold | 1,009.90 µs(+7.09%)Baseline: 943.02 µs | 1,069.78 µs (94.40%) |
| single_root_route/single_root_route | 📈 view plot 🚷 view threshold | 968.61 µs(+7.17%)Baseline: 903.84 µs | 1,028.72 µs (94.16%) |
| single_root_route_burst/single_root_route_burst | 📈 view plot 🚷 view threshold | 18,340.00 µs(+4.99%)Baseline: 17,468.02 µs | 20,584.77 µs (89.09%) |
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds support for Rust raw identifiers (r#...) in ORM model/field names so database identifiers (table/column names) are generated without the r# prefix while the Rust Ident is preserved.
Changes:
- Use
quote::format_ident!in the symbol resolver when constructingPathSegmentidents (supports raw identifiers). - Strip raw-ident prefixes via
IdentExt::unraw()when deriving model table names and field column names. - Add unit/integration tests covering keyword/raw identifier scenarios in model parsing and migration generation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cot-codegen/src/symbol_resolver.rs | Builds path segments with format_ident! to correctly handle raw identifiers in resolved paths. |
| cot-codegen/src/model.rs | Uses unraw() for table/column name derivation and adds unit tests for raw names. |
| cot-cli/tests/migration_generator/keywords.rs | Adds a keyword/raw-identifier model fixture used by migration generator tests. |
| cot-cli/tests/migration_generator.rs | Adds integration tests validating generated migrations and source contain correct identifiers for keyword/raw names. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.